#include <iostream>
#include <vector>

void ReadInput (std::vector <int> &elements, int array_size) {
    for (int iteration = 0; iteration < array_size; ++iteration) {
        int element;
        std::cin >> element;
        elements.push_back(element);
    }
}

template <typename iterator_type, typename data_type>
iterator_type Partition (iterator_type begin, iterator_type end, data_type element) {
    iterator_type output_iterator = begin;
    int count = 0;
    while (begin != end) {
        if (*begin < element) {
            ++count;
        }
        ++begin;
    }
    for (int iteration = 0; iteration < count; ++iteration) {
        ++output_iterator;
    }
    return output_iterator;
}

template <typename output_type>
void PrintAnswer (output_type answer) {
    std::cout << answer << "\n";
}

int main() {
    int array_size;
    std::cin >> array_size;
    if (array_size == 0) {
        std::cout << "0\n0";
        return 0;
    }
    std::vector <int> elements;
    ReadInput (elements, array_size);
    int partition_element;
    std::cin >> partition_element;
    auto partition_point = Partition (elements.begin(), elements.end(), partition_element);
    int answer = partition_point - elements.begin();
    PrintAnswer (answer);
    PrintAnswer (elements.size() - answer);
    return 0;
}